package ch.ethz.inf.shop.model.simpleDatabase.operators.tests;

import junit.framework.Assert;

import org.junit.Test;

import ch.ethz.inf.shop.model.simpleDatabase.operators.Project;
import ch.ethz.inf.shop.model.simpleDatabase.operators.Scan;

public class TestProject {

	@Test
	public void testUserTable() {

		Project p = new Project(new Scan(AllTests.ROOT_DIRECTORY + "/registered_user.txt", "registered_user"), new String[] { "registered_user.email",
				"registered_user.name", "registered_user.user_id" });
		Assert.assertTrue(p.moveNext());

		Assert.assertEquals("philipp.rohr@gmail.com", p.current().getString(0));
		Assert.assertEquals("rop", p.current().getString(1));
		Assert.assertEquals(1, p.current().getInt(2));

		Assert.assertTrue(p.moveNext());

		Assert.assertEquals("patric.rousselot@gmail.com", p.current().getString(0));
		Assert.assertEquals("patric", p.current().getString(1));
		Assert.assertEquals(2, p.current().getInt(2));

		Assert.assertFalse(p.moveNext());
	}

}
